<?php

namespace App\Services\FourElement;

class FourElementVerificationResult
{
    public bool $passed;

    public string $message;

    public ?string $code;

    public array $context;

    public function __construct(bool $passed, string $message, ?string $code = null, array $context = [])
    {
        $this->passed = $passed;
        $this->message = $message;
        $this->code = $code;
        $this->context = $context;
    }

    public static function passed(string $message = '四要素验证通过', array $context = []): self
    {
        return new self(true, $message, null, $context);
    }

    public static function failed(string $message, ?string $code = null, array $context = []): self
    {
        return new self(false, $message, $code, $context);
    }
}
